home *** CD-ROM | disk | FTP | other *** search
/ PC User 2003 May / Disc 1 / PCU0503CD1.iso / resource / network / files / lannetsc.exe / {app} / Sample LANS scripts / regexp.lans < prev    next >
Encoding:
Text File  |  2002-01-31  |  688 b   |  25 lines

  1. # test regular expressions
  2. # usage : regexp (regex, text_to_match)
  3. # returns 1 in case of a match
  4. #         0 otherwise
  5. string regex
  6. string text_to_match
  7.  
  8. # will match Solaris ftp servers with this versions:
  9. # 2.6, 2.7, 2.8 and 5.6, 5.7, 5.8
  10. regex = "FTP server \(SunOS (2|5)\.[678]\) ready"
  11.  
  12. text_to_match  = "220 mars FTP server (SunOS 5.7) ready."
  13. if regexp(regex, text_to_match) = 1
  14.    echo(text_to_match + " matched")
  15. else
  16.    echo(text_to_match + " not matched !")
  17. end if
  18.  
  19. text_to_match  = "220 mars FTP server (SunOS 5.5) ready."
  20. if regexp(regex, text_to_match) = 1
  21.    echo(text_to_match + " matched")
  22. else
  23.    echo(text_to_match + " not matched !!!")
  24. end if
  25.